
Ext.namespace('Vas.widget');

Vas.widget.DynamicGridPanel = function(config) {
	var _this  = this;
	this.config = config;
    Vas.widget.DynamicGridPanel.superclass.constructor.call(this,config);
}


Ext.extend(Vas.widget.DynamicGridPanel,Ext.grid.EditorGridPanel,{
	
	title           : "Test Grid",
	
	width   		: 300,
	
	height   		: 300,
	
	frame           : false,
	
	border          : false,
	
	enableColLock   : false,
	
	loadMask        : true,
	
	border          : true,
	
	stripeRows      : true,
	
	columns         : [],
	
	sm  : new Ext.grid.RowSelectionModel({singleSelect:true}),


	//tbar            : [],	
			
	baseParams : {
		start  : 0,
		limit  : 10
	},
	
    viewConfig : {
        forceFit: true
    },
	

    
	
	initComponent  : function() {
		var _this  = this;
		this.cm = new Ext.grid.ColumnModel(this.config.init.cm);
		
	
//		this.cm = new Ext.grid.ColumnModel([
//		    {header:'编号',dataIndex:'id'},
//		    {header:'名称',dataIndex:'name'},
//		    {header:'性别1',dataIndex:'sex'}
//		]);	
		this.ds = new Ext.data.Store({
//		    proxy :new Ext.data.HttpProxy({
//		    	url:this.config.url
//		    }), 
		    reader: new Ext.data.JsonReader()
		});	
		
		this.ds.loadData(this.config.data.records,false);
		
		Vas.widget.DynamicGridPanel.superclass.initComponent.apply(this, arguments);
	},
	
	
	
	onRender : function(ct, position) {
		Vas.widget.DynamicGridPanel.superclass.onRender.call(this, ct, position);
	}
	
})

Ext.reg('dynamicGridPanel', Vas.widget.DynamicGridPanel);




